package com.headStorm;

import com.alibaba.fastjson.JSONObject;
import com.google.common.net.HttpHeaders;
import com.headStorm.factory.Main;

import java.io.DataOutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * @author zhangqq
 * @create 2021-02-03 15:19
 **/
public class JsonUse {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String url = "https://xxx.xxx.xx?sig=Tr5VnQ1enApvTxZJxsr99Bb5m%2BhM1%2FpSxXUOrmAVjN8%3D";
        //将String的url转为URI对象
//        URI uri = new URI(url);
//        System.out.println(uri.toString());

        String decode = URLDecoder.decode("https://xxx.xxx.xx?sig=Tr5VnQ1enApvTxZJxsr99Bb5m%2BhM1%2FpSxXUOrmAVjN8%3D", "utf-8");
        System.out.println(decode);

        Map<Integer, String> map = new HashMap<>();
        map.put(1, "111");
        map.put(2, "222");
        map.put(3, "333");
        map.put(4, "444");

        Iterator<Map.Entry<Integer, String>> iterator = map.entrySet().iterator();
        while (iterator.hasNext()){
            Map.Entry<Integer, String> next = iterator.next();
            String value = next.getValue();
            if("111".equals(value)){
                iterator.remove();
                System.out.println(map.size());
            }
        }
    }
}
